All Questions
Tagged with xmltext-processing
102 questions
-1votes
2answers
64views
How to print the content inside the tag using grep command? [closed]
In linux, how can we use grep command to print the contents that comes inside this tag? <errorPayload>XXXXXXXX</errorPayload> I tried grep -Po '<errorPayload>' abc.log, but it only ...
3votes
3answers
183views
SED command to delete a forward slash "/" between 2 tags
I am using Linux, and I want to use sed to delete a forward slash (/) between 2 tags. From this: input.xml... <file>/text</file> <file>/text2</file> <file>/text</file&...
4votes
4answers
1kviews
Can I extract complete dates from file with grep command?
I need help using grep to extract a zoned date time from a file on a Linux system. Source file is a XML with the data below: <item start="20231010073000 +0100" stop="20231010100000 +...
0votes
2answers
58views
script to swap strings containing newlines within text file (XML)
I am using Arch which was updated a couple of weeks ago. Packages is use are Arch 6.0.10-arch2-1 BASH 5.1.16(1)-release gnu sed 4.9 gnu grep 3.8 openbox 3.6.1 Within my Openbox rc.xml text file I ...
3votes
3answers
531views
Identify strings between patterns and print entire region between pattern if string is found. Perferably using awk
There are similar questions but none of them quite address the issue I have. Simply put, I need to print every block that contains any string I'm looking for. Each block start line contains: <entry ...
5votes
2answers
2kviews
Deleting an XML tag in a huge file
I have difficulty parsing a huge XML file (about 100GB with large nodes). I am trying to reduce the node sizes by deleting unnecessary tags. For example, any <text> tags. If I use native XML ...
2votes
1answer
132views
How to untag, in an XML file, a chain of tagged characters that are embedded within specified tags
What is the xmlstarlet command to untag, in an XML file, a chain of tagged characters that are embedded within specified tags? Example: searching every occurrence of the tag <b>, that needs to ...
4votes
1answer
887views
How to rename, in an XML file, specific tags that are embedded in some other specific tags
What is the xmlstarlet command to replace a tag value by another one, only for specified tags embedded in other specified tags? Example: searching every occurance of the tag b, that needs to be ...
2votes
1answer
5kviews
How to replace, in an XML file, specific strings of characters in some specified tags with other strings of characters embedded in tags
I need to replace, in an XML file, specific strings of characters in some specified tags with other strings of characters embedded in tags. Example searching every occurance of an example, that needs ...
-1votes
2answers
1kviews
Change the value of an XML tag using awk or sed
So I have an XML file <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/...
0votes
1answer
264views
Insert line after an XML file
I have a file that contains a small XML snippet. I also have a large XML file. The large XML file has a line that includes <build>. In Bash, How can I insert the contents of the small file after ...
1vote
5answers
1kviews
Replace hyphen(s) with underscore(s) within angle brackets in a file
I’m aware of how to replace string; e.g., replace hyphen with underscore in a file. However, I wish to replace all hyphens with underscore for all text that falls within angle brackets in a given file....
-1votes
2answers
152views
Counting TAB/SPACES before a particular line
I have a requirement in which I need to identify a field in a file, If found than I will have to add a new line and add some text. But I want to count the number of SPACES before the word found so ...
0votes
3answers
852views
Change the format of a XML string which have date timestamp in the middle inside a lot of text files in the same folder (*.txt)
I have a lot of text files with dates in XML formated as follows: <DATA2020-04-13T08:59:05.427 /> Need to change into this: <DATA>2020-04-13T08:59:05.427</DATA> Notes: The date and ...
0votes
4answers
989views
How to remove text between two keywords in a textfile
Context : GNU/Linux Ubuntu. I've a file made of thousands of lines and I'd like to have a script that will remove some lines between 2 specific keywords. Initial file is like: bla bla ... bla bla ...